

* Open log
capture log close
log using "Data analysis\cbld-analysis02-app.log", replace text


* ************************************************************************************************
* Appendix: Additional results for 'The predicted effects of voting threshold and membership size'
* ************************************************************************************************

* Programme:	cbld-analysis02-app.do
* Project:		Council coalition building
* Author:		Frank Haege, Department of Politics and Administration, University of Limerick
* Contact:		frank.haege@ul.ie

* Description
*************
* This do-file generates a table and graphs presenting the results of sensitivity analyses 
* of the model's prediction regarding the effect of the new Lisbon treaty voting rules
* on consensus rates in the Council. The senstitivity analyses are based on models that   
* incorporate real-world voting weights and thresholds, and in which the sequence of moves 
* of member states is ordered according to voting weights (from smallest to largest). 


* Set up Stata
version 11
clear all
macro drop _all
set linesize 80
set more off


* Prepare data set of predicted consensus rates based on model with weighted votes
**********************************************************************************

* Load data set 
use "Experiments\Experiment03\cbld-management04-exp03.dta", clear

* Drop redundant variables
drop e* se lowerci upperci

* Generate variable for merge
generate vthresh = .
replace vthresh = 72 if regime <= 9 
replace vthresh = 74 if regime > 9 & regime <= 15
replace vthresh = 65 if regime > 15

* Rename consensus rate variable based on weighted votes
rename consensus consensusw

* Label variables
label var nostates "Number of member states"
label var vthresh "Voting threshold"
label var consensusw "Predicted consensus rate (weighted votes)"

* Reorder variables
order rulemembersize nostates vthresh regime sequence


* Merge with and prepare data set of predicted consensus rates based on model without weighted votes
****************************************************************************************************

* Merge data sets
sort sequence nostates vthresh
merge m:1 sequence nostates vthresh using "Experiments\Experiment02\cbld-management03-exp02.dta"
drop _merge

* Drop redundant variables
drop e* se lowerci upperci

* Rescale consensus rate variables
replace consensus = consensus * 100
replace consensusw = consensusw * 100

* Label variables
label var consensus "Predicted consensus rate"


* TABLE A2.	Predicted consensus rates for various model specifications
**********************************************************************

* Generate results matrix 	
sort sequence nostates vthresh
mkmat sequence consensus consensusw /*
	*/ if (regime == 2 | regime == 3 | regime == 4 | regime == 10 | regime == 16) /*
	*/ , matrix(one)
mkmat  consensusw /*
	*/ if (regime == 2 | regime == 3 | regime == 5 | regime == 11 | regime == 17) /*
	*/ , matrix(two)
mkmat  consensusw /*
	*/ if (regime == 2 | regime == 3 | regime == 6 | regime == 12 | regime == 18) /*
	*/ , matrix(three)
matrix consensus = one, two, three
matrix colnames consensus = "sequence" "Unweighted" "One threshold" "Two thresholds" "Three thresholds"
matrix rownames consensus = "Pre-Nice 12" "Pre-Nice 15" "Nice 25" "Lisbon 27" "Nice 27" "Pre-Nice 12" "Pre-Nice 15" "Nice 25" "Lisbon 27" "Nice 27"	
matrix consensus = consensus'
matrix list consensus, format(%9.0f)	


* Fig. A9. Predicted consensus rates for models with random sequence of moves
*****************************************************************************

* sort data
sort rulemembersize
twoway (scatter consensus rulemembersize if sequence == 1 & /*
	*/ (regime == 2 | regime == 3 | regime == 4 | regime == 10 | regime == 16), /*
	*/ c(line) lcolor(white) mcolor(white)) /*
	*/ (scatter consensusw rulemembersize if sequence == 1 & /*
	*/ (regime == 2 | regime == 3 | regime == 4 | regime == 10 | regime == 16), /*
	*/ c(line) lcolor(yellow) mcolor(yellow) msymbol(square)) /*
	*/ (scatter consensusw rulemembersize if sequence == 1 & /*
	*/ (regime == 2 | regime == 3 | regime == 5 | regime == 11 | regime == 17), /*
	*/ c(line) lcolor(yellow) mcolor(yellow) msymbol(diamond)) /*
	*/ (scatter consensusw rulemembersize if sequence == 1 & /*
	*/ (regime == 2 | regime == 3 | regime == 6 | regime == 12 | regime == 18), /*
	*/ c(line) lcolor(yellow) mcolor(yellow) msymbol(triangle)) /*
	*/ , ytitle("Consensus Rate (%)") ylabel(50 60: 100) xlabel(, valuelabel) xscale(range(0.5 5.5)) /*
	*/ legend(order(1 "Unweighted" 2 "One threshold" 3 "Two thresholds" 4 "Three thresholds") /*
	*/ cols(1) ring(0) position(7) bmargin(large) region(style(none)))


* Fig. A10. Predicted consensus rates for models with sequence of moves ordered by size
***************************************************************************************
	
twoway (scatter consensus rulemembersize if sequence == 2 & /*
	*/ (regime == 2 | regime == 3 | regime == 4 | regime == 10 | regime == 16), /*
	*/ c(line) lcolor(white) mcolor(white)) /*
	*/ (scatter consensusw rulemembersize if sequence == 2 & /*
	*/ (regime == 2 | regime == 3 | regime == 4 | regime == 10 | regime == 16), /*
	*/ c(line) lcolor(yellow) mcolor(yellow) msymbol(square)) /*
	*/ (scatter consensusw rulemembersize if sequence == 2 & /*
	*/ (regime == 2 | regime == 3 | regime == 5 | regime == 11 | regime == 17), /*
	*/ c(line) lcolor(yellow) mcolor(yellow) msymbol(diamond)) /*
	*/ (scatter consensusw rulemembersize if sequence == 2 & /*
	*/ (regime == 2 | regime == 3 | regime == 6 | regime == 12 | regime == 18), /*
	*/ c(line) lcolor(yellow) mcolor(yellow) msymbol(triangle)) /*
	*/ , ytitle("Consensus Rate (%)") ylabel(50 60: 100) xlabel(, valuelabel) xscale(range(0.5 5.5)) /*
	*/ legend(order(1 "Unweighted" 2 "One threshold" 3 "Two thresholds" 4 "Three thresholds") /*
	*/ cols(1) ring(0) position(7) bmargin(large) region(style(none)))


log close
exit
